Alias Control with Read-Only References
نویسندگان
چکیده
In object-oriented programs, the possibility of having an alias to an object’s mutable state is a known source of bugs making programs dif£cult to test and maintain. We propose an access mode system for limiting the effects of aliasing by associating, with each reference, an access right to the object to which the reference refer. Mutator methods may not be invoked on read references, and only read references to the state can be obtained via any method invoked on a read reference. This enables exporting read references to objects without risking the objects being modi£ed. The system realises access modes by annotations on variables, methods, method returns and parameters to methods. It is completely statically checkable without any need for run-time representation of modes and does not impose any run-time overhead.
منابع مشابه
Aliasing, Confinement, and Ownership in Object-Oriented Programming IWACO Workshop Report
The power of objects lies in the flexibility of their interconnection structure. But this flexibility comes at a cost. Because an object can be modified via any alias, object-oriented programs are hard to understand, maintain, and analyze. Aliasing makes objects depend on their environment in unpredictable ways, breaking the encapsulation necessary for reliable software components, making it di...
متن کاملRely-Guarantee References for Refinement Types
Reasoning about side effects and aliasing is the heart of verifyingimperative programs. Unrestricted side effects through one refer-ence can invalidate assumptions about an alias. We present a newtype system approach to reasoning about safe assumptions in thepresence of aliasing and side effects, unifying ideas from referenceimmutability type systems and rely-guarantee progr...
متن کاملAlias Analysis for Exceptions in Java
We propose a flow-sensitive alias analysis algorithm that computes safe and efficient alias sets in Java. For that, we propose a references-set representation of aliased elements, its type table, and its propagation rules. Also, for an exception construct, we consider try/catch/finally blocks as well as potential exception statement nodes while building a control flow graph. Finally, for the sa...
متن کاملSelective Runtime Memory Disambiguation in a Dynamic Binary Translator
Alias analysis, traditionally performed statically, is unsuited for a dynamic binary translator (DBT) due to incomplete control-flow information and the high complexity of an accurate analysis. Wholeprogram profiling, however, shows that most memory references do not alias. The current technique used in DBTs to disambiguate memory references, instruction inspection, is too simple and can only d...
متن کاملWhy we should not add readonly to Java (yet)
In this paper, I examine some of reasons that “readonly” style qualifiers have been proposed for Java, and also the principles behind the rules for these new qualifiers. I find that there is a mismatch between some of the motivating problems and the proposed solutions. Thus I urge Java designers to proceed with caution when adopting a solution to these sets of problems. 1 Proposals for “readonl...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2002